package demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class W7_StringSubtract {
	public static void main(String[] args) {
		stringSubtract("ppRYYGrrYBR2258","YrR8RrY");
		stringSubtract("ppRYYGrrYB225","YrR8RrY");
	}

	private static void stringSubtract(String big, String small) {
		Map<Character, Integer> map1 =new HashMap();
		Map<Character, Integer> map2 =new HashMap();
		char[] charArray2 = small.toCharArray();
		
		for(char key1:big.toCharArray()){
			if(map1.containsKey(key1)){
				int value1 = map1.get(key1);
				value1++;
				map1.put(key1, value1);
			}else{
				map1.put(key1, 1);
			}
		}
		for(char key2:small.toCharArray()){
			if(map2.containsKey(key2)){
				int value2 = map2.get(key2);
				value2++;
				map2.put(key2, value2);
			}else{
				map2.put(key2, 1);
			}
		}

		Set<Character> keySet = map1.keySet();
		Iterator<Character> iterator = keySet.iterator();
		int length = 0;
		int yesOrNo = 0;
		while(iterator.hasNext()){
			char key = iterator.next();
			if(map2.containsKey(key)){
				if((map1.get(key)-map2.get(key))<0){
					yesOrNo = 1;
					break;
				}else{
					length += map1.get(key)-map2.get(key);
				}
			}else{
				length += map1.get(key);
			}
		}
		if(yesOrNo == 1){
			System.out.println("No!");
		}else{
			System.out.println("Yes "+length);
		}
	}
}
